package com.codemonkey.lq.extend.excelverification;

public abstract class AbstractVerifier implements Verifier {

	@Override
	public boolean verify(CellContext cellContext) {
		boolean isPass = doVerify(cellContext);
		return isPass;
	}

	protected abstract boolean doVerify(CellContext cellContext);

	/**
	 * 附加上普遍的Context信息
	 * @param cellContext
	 * @param sb
	 */
	protected void commonConstructFailContextInfo(CellContext cellContext, StringBuilder sb) {
		sb.append(" current fieldName : [ ").append(cellContext.getCellName()).append(" ] ")
				.append(System.lineSeparator());
		sb.append(" current Val : [ ").append(cellContext.getCellVal()).append(" ] ").append(
				System.lineSeparator());
		sb.append(" current Context : [ ").append(cellContext.getRowContext()).append(" ] ")
				.append(System.lineSeparator());
	}
}
